using CfgTable;
using IQIGame.Onigao.Framework;

namespace IQIGame.Onigao.GamePlay
{
    public class DynMainCityRegion : IReusableClass
    {
        public CfgRegionInstance cfgRegion { get; private set; }
        public MainCitySceneConfig gameplayConfig { get; private set; }
        public MainCityRegionData regionSaveData { get; private set; }

        public uint MaxStore => 1;

        public static DynMainCityRegion Create(CfgRegionInstance cfgRegion, MainCitySceneConfig gameplayConfig, MainCityRegionData regionSaveData)
        {
            var dyn = ClassPool<DynMainCityRegion>.Get();
            dyn.cfgRegion = cfgRegion;
            dyn.gameplayConfig = gameplayConfig;
            dyn.regionSaveData = regionSaveData;
            return dyn;
        }

        public void Release()
        {
            ClassPool<DynMainCityRegion>.Put(this);
        }

        public void OnReset()
        {
            this.cfgRegion = null;
            this.gameplayConfig = null;
            this.regionSaveData = null;
        }
    }
}
